<template>
    <div>
        <CategorySelector :isForbiddenForm="scene == 1"></CategorySelector>
        <el-card style="margin-top: 10px;">
            <SpuList v-if="scene === 1" @changeScene="saveScene" @getSpuInfo="saveSpuInfo"></SpuList>
            <SpuForm v-if="scene === 2" @changeScene="saveScene" :currentSpuInfo="currentSpuInfo"></SpuForm>
        </el-card>
    </div>
</template>

<script lang="ts">
import CategorySelector from '@/components/CategorySelector/index.vue'
import SpuList from './components/SpuList.vue'
import SpuForm from './components/SpuForm.vue'

export default {
    name: 'Spu',
    components: { CategorySelector, SpuList, SpuForm }
}


</script>

<script lang="ts" setup>
import { ref } from 'vue'
const scene = ref(1)
const currentSpuInfo = ref([])
const saveScene = (val: number) => {
    scene.value = val
}

const saveSpuInfo = spuInfo => {
    currentSpuInfo.value = spuInfo
}

</script>